/* Copyright (C) 2008 Sahid Ferdjaoui <sahid@funraill.org>
 *
 *   This file is part of Postmemd.
 *
 * Postmemd is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef PM_ATOM_H
#define PM_ATOM_H

#include "uthash.h"


struct atom {
	char									key[41]; /* by sha1 */
	char								* data;
	int										data_bytes;
	int										expire;
	UT_hash_handle				hh; 
};

typedef struct atom			atom_t;

extern atom_t * atoms;

int pm_atom_init (atom_t ** atom);
int pm_atom_get (const char key[], atom_t ** atom);
int pm_atom_add (atom_t * atom);
int pm_atom_del (const char key[]);


#endif
